package com.dragon.repository.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.dragon.repository.entity.OtherFile;
import com.dragon.repository.entity.Payment;
import com.dragon.repository.entity.WorkflowJson;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PaymentDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "自增id")
    private Integer id;

    @ApiModelProperty(value = "总付款金额")
    private Double money;

    @ApiModelProperty(value = "本次付款金额")
    private Double thisTimeMoney;

    @ApiModelProperty(value = "类型：1供应商2工资3日常4其他")
    private Integer type;

    @ApiModelProperty(value = "供应商id")
    private Integer supplierId;

    @ApiModelProperty(value = "供应商名称")
    private String supplierName;

    @ApiModelProperty(value = "申请人")
    private Integer adminId;

    @ApiModelProperty(value = "部门id")
    private Integer departmentId;

    @ApiModelProperty(value = "主题")
    private String title;

    @ApiModelProperty(value = "事由")
    private String incident;

    @ApiModelProperty(value = "审核状态：0待审核 1审核通过 2审核不通过 3作废 4删除")
    private Integer status;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "付款时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date payTime;

    @ApiModelProperty(value = "删除标识: 0未删除 1已删除")
    private Integer deleted;

    @ApiModelProperty(value = "申请人名称")
    private String adminName;

    @ApiModelProperty(value = "部门名称")
    private String departmentName;

    @ApiModelProperty(value = "工作流json")
    private List<WorkflowJson> workflowJsonList;

    @ApiModelProperty(value = "付款附件")
    private List<OtherFile> otherFileList;

    @ApiModelProperty(value = "付款状态：0未付款 1已付款")
    private Integer paymentStatus;

    @ApiModelProperty(value = "确认付款时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date confirmPayTime;

    @ApiModelProperty(value = "付款账号")
    private String payAccount;

    @ApiModelProperty(value = "付款类型")
    private Integer payType;



    public PaymentDTO() {}

    public PaymentDTO(Payment entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static PaymentDTO convert(Payment entity) {
        return new PaymentDTO(entity);
    }

    public static List<PaymentDTO> convertList(List<Payment> list) {
        List<PaymentDTO> resultList = new ArrayList<>();
        for (Payment entity : list) {
            resultList.add(new PaymentDTO(entity));
        }
        return resultList;
    }}
